{extend name="default/template/base_index" /}

{block name="area_header"}
<style>
  .w80{ width:80px; }
</style>
{/block}

{block name="area_body"}
{include file="default/Widget/topbar" /}
<div class="admin-main container-fluid">
  {include file="default/Widget/left" /}
  <div class="admin-main-content">
  {include file="default/Widget/breadcrumb" /}
    <div class="table-responsive well">
      <h2>题目编辑</h2>

      <div class="btn-controls">
        <a class="btn btn-sm btn-primary" href="{:url('Testpaper/question',['id'=>$test_id])}"
           ><i class="fa fa-plus"></i>添加题目</a>
        <a class="btn btn-danger btn-sm ajax-post " href="{:url('Testpaper/bulkqdel')}"
           target-form="selectitem"><i class="fa fa-trash-o"></i>删除选中题目</a>
        <a href="{:url('Testpaper/index')}" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回</a>
      </div>

      <table class="table table-striped table table-hover  table-condensed">
          <thead>
          <tr>
            <th width="80px;">
              <input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');"/>ID</th>
            <th>题号</th>
            <th>类型</th>
            <th>自定义标志</th>
            <th>所属部分</th>
            <th>分值</th>
            <th>排序</th>
            <th>操作</th>
          </tr>
          </thead>
          <tbody>

            {empty name="list"}
            <tr>
              <td colspan="7" class="text-center">{:L('NO_DATA')}</td>
            </tr>
            {else/}
            {volist name="list"  id="vo"}
            <form class="select_{$vo.id}">
              <input type="hidden" value="{$vo['id']}" name="id"/>
            <tr>
              <td data-id="{$vo['id']}">
                <input type="checkbox" value="{$vo.id}" name="ids[]" class="selectitem"/>{$vo.id}</td>
              <td>
                {$vo['title']|default=""}</td>
              <td>
                {:$dt_types[$vo['dt_type']]['name']}</td>
              <td>
                {$vo['note']|default=''}</td>
              <td>
                <select class="form-control" name="dt_part" id="js-dt-type"/>
                {volist name="dt_parts" id="v"}
                <option value="{$v.id}"  {eq name="v['id']" value="$vo['dt_part']"}selected{/eq} >{$v.name}</option>
                {/volist}
                </select>
              </td>
              <td>
                <input type="number" value="{$vo['score']/10}" name="score" class="form-control w80" min="0.0" step="0.1"/>
              </td>
              <td>
                <input type="number" value="{$vo['sort']|default=''}" name="sort" class="form-control w80" min="0"/>
                </td>
              <td>
                <button class="ajax-post btn btn-primary btn-sm"
                   href="{:url('Testpaper/qdel',['id'=>$vo['id']])}"><i class="fa fa-trash-o"></i>{:L('BTN_DELETE')}</button>
                <button target-form="select_{$vo.id}" class="ajax-post btn btn-primary btn-sm"
                   href="{:url('Testpaper/qsave')}"><i class="fa fa-save"></i>{:L('BTN_SAVE')}</button>
              </td>
            </tr>
            </form>

            {/volist}
            {/empty}

          </tbody>
      </table>
      <div>{$show}</div>
    </div>
  </div>
  <!-- END admin-main-content -->
</div>
<!-- END admin-main-->
{/block}

{block name="area_footer"}
<script>

</script>
{/block}